package com.xiaoma.tpo.dto;

import org.apache.commons.lang.StringUtils;

public class UserDto implements Validator{

    private String name;
    private String password;
    private String nickname;
    private String email;
    private String phone;
    private String registerFrom;
    private String examDate;
    private String avatar;

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getNickname() {
        return nickname;
    }
    public void setNickname(String nickname) {
        this.nickname = nickname;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getRegisterFrom() {
        return registerFrom;
    }
    public void setRegisterFrom(String registerFrom) {
        this.registerFrom = registerFrom;
    }

    public String getExamDate() {
        return examDate;
    }

    public void setExamDate(String examDate) {
        this.examDate = examDate;
    }

    public String validate() {
        String result = "";
        if(StringUtils.isEmpty(this.name)) {
            this.name = null;
            result += "(name is empty)";
        }
        if(StringUtils.isEmpty(this.password)) {
            this.password = null;
            result += " (password is empty)";
        }
        if(StringUtils.isEmpty(this.registerFrom)) {
            this.registerFrom = null;
            result += " (registerFrom is empty)";
        }
        return result;
    }
    
}

